#include "Vector.h"

double y(double x);
double y(double x) {
    double result =
	//1;
	exp(x);
	//pow(x,19) + 3*pow(x,2) -2*x +5;
    return result;
}
int main(int argc, char* argv[]) {
    /*
    double a = 0;
    double b = 10.6666666;
    int n = 500;
    Vector<double,2> arr[n + 1];
    double h = (b - a)/n;
    double x = a;
    for (int i = 0 ; i < n + 1 ; ++i ) {
	Vector<double,2> tmp{x,y(x)};
	x += h;
	arr[i] = tmp;
    }
    Set<2> U(arr,arr + n + 1);
    
    std::cout << U.LagrangeInPoly(5.0001) << "\n"
	      << U.Simpson() << "\n";
    
    //*/
    
    //A = A + B;
    
    //A.print();
    //B.print();
    //*
    
    //A = 2 * B - 3.0*B;
//    double abc = 4.03 - 4.02;
//    A.print();
    //  B.print();
    /*
    std::cout << std::setprecision(100) << myplus(2.000000123456789,-1.000000012345678) << "\n";
    std::cout << std::setprecision(100) << 1.000000111111111 << "\n";
    if (myplus(6123456.03,-6123456.02) == 0.01) {
	std::cout << "=" << "\n";

    }
    */

    Vector<Vector<double,4>,4> K{{3,4,5,1},{6,8,9,2},{3,2,1,1},{2,3,4,1}};
    Vector<Vector<double,7>,7> H{
	{3,4,5,1,11,7,9},
	{6,8,9,2,7,3,1},
	{5,3,2,1,1,11,13},
	{1,2,3,2,3,4,1},
	{1,11,13,1,2,3,2},
	{3,1,5,3,2,1,1},
	{7,9,6,8,9,2,7}
    };
    Vector<double,3> b {7.2,8.3,4.2};
    Vector<double,7> b1 {
	1,
	4,
	5,
	1,
	8,
	3,
	6
    };
    Vector<Vector<double,3>,3> A {
	{10,-1,-2},
	{-1,10,-2},
	{-1,-1,5}
    };
    Vector<double,3> test {1,-1,1};
    H.print();
    //(del(K,3,2)).print();
    std::cout << det(H) << "\n";
    std::cout << L1norm(test) << "\n";

    GSMethod(A,b,0.000000001);
    GSMethod(A,b,0.00000000001);
    GElimination(A,b);
    GElimination(H,b1);
    return 0;
};
